﻿@model UserListModel
@{
    ResLink.AddCss("~/res/css/user/list.css");
}

<h1>사용자 목록</h1>
<hr />

<div class="form-inline">
    <span>분류:</span>
    @Html.DropDownListFor(m => m.pagination.category, BL사용자.사용자분류목록, new { onchange = "사용자분류변경(this.value)" })
    @Html.DropDownListFor(m => m.pagination.srchType, BL사용자.검색유형목록)
    @Html.TextBoxFor(m => m.pagination.srchText)
    <a class="btn btn-small" onclick="검색()">검색</a>
</div>

<table class="table table-condensed table-bordered">
    <thead>
        <tr>
            <th>ID</th>
            <th>로그인ID</th>
            <th>이름</th>
            <th>이메일</th>
            <th>역할</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var 항목 in Model.사용자목록) {            
            <tr onclick="location.href = '@Url.MyAction("Edit", "User", new { id = 항목.ID })'">
                <td>@항목.ID</td>
                <td>@항목.로그인ID</td>
                <td>@항목.이름</td>
                <td>@항목.이메일</td>
                <td>@항목.역할</td>
            </tr>
        }
    </tbody>
</table>

<div class="controls pull-right form-inline">
    화면크기: 
    @Html.DropDownListFor(m => m.pagination.size, new SelectList(Consts.페이지크기목록), new { onchange = "페이지크기변경(this.value)" })
</div>

@Html.Partial("_Pagination", Model.pagination)

<hr />

<script type="text/javascript">
    function 사용자분류변경(category) {
        var url = "@Html.Raw(Url.UserListCategory(9991))";
        location.href = url.replace("9991", category);
    }
    function 페이지크기변경(size) {
        var url = '@Html.Raw(Url.UserListResize(9991))';
        location.href = url.replace("9991", size);
    }

    function 검색() {
        var url = '@Html.Raw(Url.UserListSearch(9991, "9992"))';
        var 검색유형 = $('select[name$=srchType]').val();
        var 검색어 = encodeURIComponent($('input[name$=srchText]').val().trim());
        location.href = url.replace("9991", 검색유형).replace("9992", 검색어);
    }
</script>    

